/******************************************************************************* 
 * Copyright (C) 2012-2015 Microfountain Technology, Inc. All Rights Reserved. 
 * 
 * Unauthorized copying of this file, via any medium is strictly prohibited.   
 * Proprietary and confidential
 * 
 * Last Modified: 2015-11-24 17:57:47
 ******************************************************************************/
package cn.com.xy.sms.util;

import java.util.HashMap;

import org.json.JSONObject;

import android.content.Context;
import cn.com.xy.sms.sdk.dex.DexUtil;
import cn.com.xy.sms.sdk.log.LogManager;
import cn.com.xy.sms.sdk.service.operatorservice.OperatorService;

public class ParseOperatorManager {

    static final String TAG = "ParseOperatorManager";

    /***
     * 获取运营商指令。查询余额指令，查询流量指令
     * 
     * @param phoneNum
     *            手机号
     * @param simIccid
     *            simIccid
     * @param extend
     *            扩展参数(operator, province)
     * @param callBack
     *            回调，如果说本地没有则走网络查询。需要回调。
     * @return jsonobj 流量指令key：op_flow 余额指令key: op_balance
     * 
     */
    public static JSONObject queryOperatorCmd(Context ctx, String phoneNum, String simIccid, HashMap<String,String> extend, SdkCallBack callBack) {
        try {
            return OperatorService.queryOperatorCmd(phoneNum, simIccid, extend, callBack);
        } catch (Throwable e) {
            LogManager.e(TAG, "queryOperatorCmd ", e);
        }
        return null;
    }

    /**
     * 解析运营商短信
     * 
     * @param ctx
     * @param msgId
     *            消息ID
     * @param smsReceiveNum
     *            对应的短信接入码
     * @param smsCenterNum
     *            对应的短信中心号码
     * @param smsContent
     *            短信内容
     * @param smsTime
     *            短信接收时间
     * @param extend
     *            扩展参数
     * @return
     */
    public static JSONObject parseOperatorMsg(Context ctx, String msgId, String smsReceiveNum, String smsCenterNum, String smsContent, long smsTime, HashMap<String,String> extend,SdkCallBack callBack) {
        try {
            return OperatorService.parseOperatorMsg( ctx,  msgId,  smsReceiveNum,  smsCenterNum,  smsContent,  smsTime,  extend,callBack);
        } catch (Throwable e) {
            LogManager.e(TAG, "parseOperatorMsg ", e);
        }
        return null;
    }
    
    /**
     * 判断是否运营商号码接口
     * 
     * @param phoneNum
     *        对应的短信号码
     * @return
     */
    public static Boolean isOperatorMsgPhone(String phoneNum){
        try {
            return DexUtil.isOperatorsPhoneType(phoneNum);
        } catch (Exception e) {
            LogManager.e(TAG, "isOperatorMsgPhone ", e);
        }
        /* SDK-476 songzhirong 2016-06-07 start*/
        return false;
        /* SDK-476 songzhirong 2016-06-07 start*/

        
    }

}
